<?xml version='1.0' encoding='UTF-8' ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml" 
      xmlns:f="http://java.sun.com/jsf/core" 
      xmlns:h="http://java.sun.com/jsf/html" 
      xmlns:p="http://primefaces.prime.com.tr/ui"
      xmlns:ez="http://java.sun.com/jsf/composite/ezcomp"> 
    <!--
    Author Lu Xiaodi
    -->
    <h:head> 
        <title>IOTR</title> 

        <style type="text/css"> 

            .gritter-notice-wrapper { 
                left:200px; 
                top:50px; 
            } 
        </style> 

    </h:head> 
    <h:body>                 
        <ez:TCubeAdminTopMenu/>
        <h1>Integrated Online Ticketing and Reservation (IOTR)- Representative Portal</h1> 

        <p:layout style="table-layout:auto; height:600px ">
            <p:layoutUnit position="left" header="Navigation" width="300">
                <ez:TCubeAdminIOTRLeftMenu/>
            </p:layoutUnit>

            <p:layoutUnit position="center" header="Settings" scrollable="true">

                <h:form>
                    <h:panelGrid columns="2">
                        <h:outputLabel value="Select Outlet: " style="font-size: x-large"/>
                        <h:outputLabel/>
                        <h:selectOneListbox id="selectOutletList" value="#{dishManagedBeanTCube.outletId}">
                            <f:selectItems var="o" value="#{dishManagedBeanTCube.allOutlets}"
                                           itemValue="#{o.id}"
                                           itemLabel="#{o.stakeholder.name}, #{o.outletName}"/>
                        </h:selectOneListbox>
                        <p:commandButton id="selectOutletSubmit" value="Go" ajax="false"
                                         update="featuredDish" >
                        </p:commandButton>
                    </h:panelGrid>
                </h:form>

                <h:form>
                    <p:dataTable id="mealList" var="dishes" value="#{dishManagedBeanTCube.allDishes}" 
                                 emptyMessage="Currently no dishes exist for this outlet"
                                 dynamic ="true" paginator="true" paginatorPosition="top" 
                                 rows="20">

                        <f:facet name="header">
                            Existing AlaCarte dishes
                        </f:facet>

                        <p:column headerText="Dish id" filterBy="#{dishes.id}">
                            <h:outputText id="id" value="#{dishes.id}" />
                        </p:column>
                        <p:column headerText="Name">
                            <h:outputText id="name" value="#{dishes.name}" />
                        </p:column>
                        <p:column headerText="Price" filterBy="#{dishes.price}">
                            <h:outputText id="stakeholder" value="#{dishes.price}" />
                        </p:column>
                        <p:column headerText="Type" filterBy="#{dishes.type}">
                            <h:outputText id="dos" value="#{dishes.type}"/> 
                        </p:column>
                        <p:column headerText="locked?" filterBy="#{dishes.locked}">
                            <h:outputText id="status" value="#{dishes.locked}" />
                        </p:column>
                        <p:column headerText="Options">
                            <p:commandButton id="lockDish" value="Lock" ajax="false"
                                             update="display" disabled="#{dishes.locked ? true : false }"
                                             actionListener="#{promotionManagedBeanRep.lockDish}">
                                <f:attribute name="dishId" value="#{dishes.id}" />
                            </p:commandButton>
                            <p:commandButton id="unlockDish" value="unlock" ajax="false"
                                             update="display" disabled="#{dishes.locked ? false : true }"
                                             actionListener="#{promotionManagedBeanRep.unlockDish}">
                                <f:attribute name="dishId" value="#{dishes.id}" />
                            </p:commandButton>

                        </p:column>
                    </p:dataTable>
                </h:form>
            </p:layoutUnit>
        </p:layout>

    </h:body> 
</html>